<?php


namespace app\admin\service\control;

use app\admin\model\BaseModel;
use app\admin\model\control\GameStock;
use app\admin\model\platform\GameKindItem;
use app\admin\model\platform\GameRoomInfo;
use app\admin\model\record\RecordModificationStock;
use app\admin\service\BaseService;
use app\admin\service\CommonService;
use think\facade\Cache;
use think\facade\Db;

/**
 * @author tangsan
 * @package app\admin\service
 */
class GameStockRecordService extends BaseService
{
    /**
     * 构造函数
     * @author tangsan
     * ActionLogService constructor.
     */
    public function __construct()
    {
        $this->model = new RecordModificationStock();
    }

    /**
     * 获取数据列表
     * @return array
     * @author tangsan
     */
    public function getList()
    {
        $param = request()->param();
        // 用户账号
        $ServerID = getter($param, "ServerID");
        if ($ServerID) {
            $map[] = ["ServerID", '=', $ServerID];
        }
        $map = [];
        $sort = 'ID desc';

        // 获取参数
        $argList = func_get_args();
        if (!empty($argList)) {
            // 查询条件
            $map = (isset($argList[0]) && !empty($argList[0])) ? $argList[0] : [];
            // 排序
            $sort = (isset($argList[1]) && !empty($argList[1])) ? $argList[1] : 'ServerID desc';
            // 是否打印SQL
            $is_sql = isset($argList[2]) ? isset($argList[2]) : 0;
        }
        $result = $this->model->where($map)->order($sort)->page(PAGE, PERPAGE)->select()->toArray();
        // 打印SQL


        //获取数据总数
        $count = $this->model->where($map)->count();

        //返回结果
        $message = array(
            "msg" => '操作成功',
            "code" => 0,
            "data" => $result,
            "count" => $count,
        );
        return $message;
    }



}